//   将静态路由和动态路由合并

import { constantRoutes } from '@/router'

//  需要在store下的index中引入
export default {
  namespaced: true,
  state: {
    routes: constantRoutes // 默认为静态路由
  },
  mutations: {
    // 将静态路由和动态路由合并到一起
    setRoutes(state, asyncRoutes) {
      state.routes = [...constantRoutes, ...asyncRoutes]
    }
  }
}
